﻿using System;
using System.Collections.Generic;
using System.Text;

namespace DataInput
{
    public class BooleanField : NumericField
    {
        public BooleanField() : base ()
        {
        }

        public override bool isValid()
        {
            if (base.isValid())
            {
                if (Equals(Value, "1") || Equals(Value, "0"))
                    return true;
                return false;
            }
            else
                return false;
        }

        public override Dictionary<string, object> getOptions()
        {
            var values = new Dictionary<string, object> {{"TRUE", "1"}, {"FALSE", "0"}};
            return values;
        }

        public BooleanField(String fieldName, String fieldLabel)
            : this(fieldName, fieldLabel, false)
        {
        }

        public BooleanField(String fieldName, String fieldLabel, Object value) : base ( fieldName, fieldLabel, value, false )
        {
        }

        public BooleanField(String fieldName, String fieldLabel, Object value, bool canBeEmpty) 
            : this (fieldName, fieldLabel, value, canBeEmpty, false )
        {
        }

        public BooleanField(String fieldName, String fieldLabel, Object value, bool canBeEmpty, bool forOutput )
            : base(fieldName, fieldLabel, value, canBeEmpty, forOutput)
        {
        }
    }
}
